package com.zhangbo.study.designpatternlearning.adapter;

/**
 * 适配器模式运行类
 */
public class AdapterRun {

    public static void main(String[] args) {
        // 定义鸭子对象，并执行它的行为
        Duck duck = new MallardDuck();
        duck.quack();
        duck.fly();

        // 定义火鸡对象，并执行它的行为
        Turkey turkey = new WildTurkey();
        turkey.gobble();
        turkey.fly();

        // 适配器对象，用火鸡来适配模拟鸭子
        Duck mallardDuck = new TurkeyAdapter(turkey);
        mallardDuck.quack();
        mallardDuck.fly();

    }

}
